<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Add</title>
    <#include "/common/base.html" >
    <style>
        table{
            width: 500px;
            margin: 0 auto;
        }
    </style>
</head>
<body class="easyui-layout">
    <div data-options="region:'center',fit: true">
        <table>
        <form method="post" id="addForm">
            <tr>
                <td>名称：</td>
                <td><input type="text" id="name" name="name" maxlength="50"></td>
            </tr>
            <!--<tr>-->
                <!--<td>年龄：</td>-->
                <!--<td><input type="text" id="age" name="age"></td>-->
            <!--</tr>-->
            <!--<tr>-->
                <!--<td>生日：</td>-->
                <!--<td><input type="text" id="birth" name="birth" onclick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})"></td>-->
            <!--</tr>-->
            <!--<tr>-->
                <!--<td>密码：</td>-->
                <!--<td><input type="password" id="password" name="password"></td>-->
            <!--</tr>-->
            <tr>
                <td><input type="button" id="save_btn" value="添加" onclick="save()"></td>
            </tr>
        </form>
        </table>
    </div>
</body>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script>
    $(function () {
        var opt = {
            url: 'add',
            type: 'POST',
            beforeSubmit: function(){
                $('#save_btn').attr('disabled',true);
            },
            success: function(rsp,status){
                $('#save_btn').attr('disabled',false);
                if(rsp['success']){
                    msg('保存成功',true);
                    closeReload();
                }else {
                    msg(rsp['info'], true);
                }
            }
        };
        $("#addForm").ajaxForm(opt);
    })

    function save() {
        //验证
        var f = submitVali();
        if(f) $("#addForm").submit();
    }
    function submitVali(){
        return true;
    }
</script>
</html>